#include <cstdio>
struct island{
	int x, y;
}a[1001];
int n, d;
inline bool cmp(island a, island b) {
	if(a.x == b.x)
		return a.y > b.y;
	else return a.x < b.y;
} 
int main() {
	scanf("%d%d", &n, &d);
	for (int i = 1; i <= n; ++i) {
		scanf("%d%d", &a[i].x, &a[i].y);
		if(a[i].y > d) {
			printf("-1\n");
			return 0;
		}
	}
	sort(a + 1, a + n + 1, cmp);
	
}
